<?php
header("content-type:text/html;charset=utf8");
$username = $_POST['username'];
$password = $_POST['password'];
$con = mysqli_connect('localhost','root','root','test');
mysqli_query($con,'set names utf8');
$res =mysqli_query($con,"select * from users where username='$username'");
$row =mysqli_fetch_assoc($res);
if($row){
    if($password===$row['password']){
        $arr=[
            "meta"=>[
                "status"=>1,
                "msg"=>"登录成功"
            ],
            "data"=>null
        ];
    }else{
        $arr=[
            "meta"=>[
                "status"=>0,
                "msg"=>"登录失败",

            ],
            "data"=>null
        ];
    }
}else{
    $arr=[
        "meta"=>[
            "status"=>3,
            "msg"=>"没有该用户",
        ],
        "data"=>null
    ];
}
echo json_encode($arr);